@using BlazorApp.Pages.Common
@using BlazorApp.Pages.Common.Html
@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Metadata
@using BlazorApp.Pages.Container
@using BlazorApp.Pages.Event
@using k8s.Models
@using Mapster
@inherits BlazorApp.Pages.Common.DrawerPageBase<k8s.Models.V1PersistentVolumeClaim>
@if (PersistentVolumeClaim != null)
{
    <PersistentVolumeClaimAction Item="PersistentVolumeClaim" MenuMode="MenuMode.Horizontal"></PersistentVolumeClaimAction>
    <Divider Orientation="left" Style="font-weight:bold">@L["Metadata"]</Divider>
    <MetadataView Item="PersistentVolumeClaim.Metadata" ExplainFieldPrefix="persistentVolumeClaim"></MetadataView>
    <Divider Orientation="left" Style="font-weight:bold">@L["Spec"]</Divider>
    <HTable Bordered Column="1">

        <PropertyListView Title=@L["AccessModes"] Items="@PersistentVolumeClaim.Spec.AccessModes"
                          ExplainField="persistentVolumeClaim.spec.accessModes" T="string">
        </PropertyListView>
        @if (PersistentVolumeClaim.Spec.DataSource != null)
        {
            <HTableColumn Title=@L["DataSource"]>
                <RefView FullView="true" Ref="@(PersistentVolumeClaim.Spec.DataSource.Adapt<V1ObjectReference>())"></RefView>
            </HTableColumn>
        }
        @if (PersistentVolumeClaim.Spec.DataSourceRef != null)
        {
            <HTableColumn Title=@L["DataSourceRef"]>
                <RefView FullView="true" Ref="@(PersistentVolumeClaim.Spec.DataSourceRef.Adapt<V1ObjectReference>())"></RefView>
            </HTableColumn>
        }

        <ContainerResourceRequestLimitsView RequestLimits="@(PersistentVolumeClaim.Spec.Resources.Adapt<V1ResourceRequirements>())" ExplainField="persistentVolumeClaim.spec.resources"></ContainerResourceRequestLimitsView>

        <LabelSelectorView Title=@L["Selector"] LabelSelector="@PersistentVolumeClaim.Spec.Selector" ExplainField="persistentVolumeClaim.spec.selector"></LabelSelectorView>
        <PropertySimpleView Title=@L["StorageClassName"] Item="@PersistentVolumeClaim.Spec.StorageClassName"
                            ExplainField="persistentVolumeClaim.spec.storageClassName">
        </PropertySimpleView>
        <PropertySimpleView Title=@L["VolumeName"] Item="@PersistentVolumeClaim.Spec.VolumeName"
                            ExplainField="persistentVolumeClaim.spec.volumeName">
        </PropertySimpleView>
        <PropertyOptionView Title=@L["VolumeMode"] Item="@PersistentVolumeClaim.Spec.VolumeMode"
                            ExplainField="persistentVolumeClaim.spec.volumeMode"
                            Options='@(new[] { "Block", "Filesystem" })'>
        </PropertyOptionView>
    </HTable>
    <Divider Orientation="left" Style="font-weight:bold">@L["Status"]</Divider>
    <HTable Bordered Column="1">
        <PropertyOptionView Title=@L["Phase"] Item="@PersistentVolumeClaim.Status.Phase" ExplainField="persistentVolumeClaim.status.phase" Options='@(new[] { "Bound", "Lost", "Pending" })'></PropertyOptionView>
        @if (PersistentVolumeClaim.Status.Conditions != null)
        {
            <ConditionsView Conditions="@(PersistentVolumeClaim.Status.Conditions.Adapt<IList<V1Condition>>())" ExplainField="persistentVolumeClaim.status.conditions"></ConditionsView>
        }
        <PropertyListView Title=@L["AccessModes"] Items="@PersistentVolumeClaim.Status.AccessModes"
                          ExplainField="persistentVolumeClaim.status.accessModes" T="string">
        </PropertyListView>
        <PropertySimpleView Title=@L["AllocatedResourceStatuses"]
                            Item="@PersistentVolumeClaim.Status.AllocatedResourceStatuses"
                            ExplainField="persistentVolumeClaim.status.allocatedResourceStatuses"
                            ShowInJson="true">
        </PropertySimpleView>
        <PropertySimpleView Title=@L["AllocatedResources"] Item="@PersistentVolumeClaim.Status.AllocatedResources"
                            ExplainField="persistentVolumeClaim.status.allocatedResources"
                            ShowInJson="true">
        </PropertySimpleView>

        <PropertyMapView Title=@L["Capacity"] Items="@PersistentVolumeClaim.Status.Capacity"
                         ExplainField="persistentVolumeClaim.status.capacity" T="ResourceQuantity">
        </PropertyMapView>


    </HTable>
    <MiniEventListView Uid="@PersistentVolumeClaim.Metadata.Uid"></MiniEventListView>
}
